<template>
	<view class="notify_con_wrap">
		<u-notify ref="notify_error">
			<u-icon color="#FF5B5B" size="15" slot="icon" name="close-circle-fill"></u-icon>
		</u-notify>
		<u-notify ref="notify_success">
			<u-icon color="#46D053" size="15" slot="icon" name="checkmark-circle-fill"></u-icon>
		</u-notify>
		<u-notify ref="notify_warning">
			<u-icon color="#A3912B" size="15" slot="icon" name="error-circle-fill"></u-icon>
		</u-notify>
	</view>
</template>

<script>
	export default {
		name:"notify",
		data() {
			return {
				
			};
		},
		methods:{
			// 参数（1,2 必填， 34选填）
			//1 *:message 内容
			//2 *: v 1成功， 2失败， 3警告
			//3: safeTop  开启安全高度  true  false   默认 开启true
			//4: time 持续时间 默认 1500
			notify(message,v,safeTop,time){
				let safeAreaInsetTop = true;
				let duration = 1500;
				if(safeTop===false){
					safeAreaInsetTop = false
				}
				if(time){
					duration = time
				}
				if(v==1){
				   this.$refs.notify_success.show({
					top:  0,
					color: '#46D053',
					bgColor: '#ECF7E8',
					// type:'warning',
					message,
					duration,
					fontSize: 15,
					safeAreaInsetTop
				   })
				}else if(v==2){
				 this.$refs.notify_error.show({
						top:  0,
						color: '#FF5B5B',
						bgColor: '#fdc8c8',
						// type:'warning',
						message,
						duration,
						fontSize: 15,
						safeAreaInsetTop
				   })
				}else{
					this.$refs.notify_warning.show({
							top:  0,
							color: '#A3912B',
							bgColor: '#FFFDD3',
							// type:'warning',
							message,
							duration,
							fontSize: 15,
							safeAreaInsetTop
					  })
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
   .notify_con_wrap{
	   
   }
</style>
